package com.sds.sweng.swat.miplatform.ui.design.models.component;

import com.sds.sweng.swat.miplatform.ui.design.figures.geps.GepsButton;
import com.sds.sweng.swat.miplatform.ui.design.figures.logical.ButtonInfo;
import com.sds.sweng.swat.miplatform.ui.design.models.MiplatformComponent;

public class MButton extends MiplatformComponent {

	private int type;

	public MButton() {

	}

	public MButton(String text, int buttonType) {
		this.type = buttonType;

		setText(text);
		ButtonInfo buttonInfo = GepsButton.getButtonInfo(buttonType, text);
		setId(buttonInfo.id);
		refresh();
	}

	public MButton clone() {
		MButton clone = (MButton) super.clone();
		clone.setType(getType());
		clone.refresh();

		return clone;
	}

	public void refresh() {
		ButtonInfo buttonInfo = GepsButton.getButtonInfo(type, text);
		setImageId(buttonInfo.imageId);
		setStyle(buttonInfo.style);
		setWidth(buttonInfo.width);
		setHeight(buttonInfo.height);
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

}
